#!/usr/bin/perl -w

$subID = "$ARGV[0]";     # Service label id
$pageID = "$ARGV[1]";   # section name
$value = "ErrorCode626";   # initializing value

open($file, "<", "ServiceLabel.txt") or die(exit(4));

while ($line = <$file>) {   # checks all lines in file

        if($line =~ 
	/^\s*$subID\s*=\s*
        \"(.+)\"
	\s*(\#.*)?$/x) 
	{
		if($1) { $value = $1; }
	}
}

#These next 5 portions will modify the text slightly depending on which page is opened.
if ($pageID =~ /1001/) {
      $value =~ s/XMod_1/10/;
      $value =~ s/XMod_2/5/;
      $value =~ s/XMod_3/1/;
      $value =~ s/XMod_4/1/;
          $value =~ s/\(\*\*1\*\*\)/\*/;
	  $value =~ s/\(\*\*4\*\*\)/\*\*/;}
  elsif($pageID =~ /1002/ || $pageID =~ /1003/) {
        $value =~ s/XMod_4/2/;
	$value =~ s/XMod_./100/;
            $value =~ s/\(\*\*1\*\*\)/\*/;
	    $value =~ s/\(\*\*4\*\*\)/\*\*/;}
    elsif($pageID =~ /1004/) {
          $value =~ s/XMod_4/3/;
          $value =~ s/XMod_./200/;
              $value =~ s/\(\*\*1\*\*\)/\*/;
              $value =~ s/\(\*\*3\*\*\)/\*\*/;
	      $value =~ s/\(\*\*4\*\*\)/\*\*\*/;}
      elsif($pageID =~ /1005/) {
            $value =~ s/XMod_4/5/;
            $value =~ s/XMod_./300/;
              $value =~ s/\(\*\*1\*\*\)/\*/;
              $value =~ s/\(\*\*2\*\*\)/\*\*/;
              $value =~ s/\(\*\*3\*\*\)/\*\*\*/;
	      $value =~ s/\(\*\*4\*\*\)/\*\*\*\*/;}

     #Output

print $value."\n";

close $file;

exit(5);

